<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/ajax/libs/fileinput/fileinput.css}" rel="stylesheet"/>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="photodetailform" th:object="${photo}">
            <input id="photoid" name="photoid" th:field="*{photoid}"  type="hidden">
			<div class="form-group">	
				<label class="col-sm-3 control-label">相册名称：</label>
				<div class="col-sm-8">
					<input id="photoname" name="photoname" th:field="*{photoname}" class="form-control" type="text" readonly="readonly">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">照片：</label>
				<div class="col-sm-8">
					<input id="photodetail" name="photodetail" th:field="*{photodetail}" class="form-control" type="text" readonly="readonly">
				</div>
			</div>
			<div class="form-group">	
				<label class="col-sm-3 control-label">照片上传：</label>
				<div class="col-sm-8">
					<input id="photodetailcoverup" name="photodetailcoverup" class="form-control" multiple   type="file" >
				</div>
			</div>
		</form>
    </div>
    <div th:include="include::footer"></div>
    <script th:src="@{/ajax/libs/fileinput/fileinput.js}"></script>
    <script th:src="@{/ajax/libs/fileinput/zh.js}"></script>
    <script type="text/javascript">
		var prefix = ctx + "system/photo"
		$("#photodetailform").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/edit", $('#photodetailform').serialize());
	        }
	    }
		
		 $('#photodetailcoverup').fileinput({
             language: 'zh', //设置语言
             uploadUrl: prefix+"/uploaddetail", //上传的地址
             allowedFileExtensions : ['jpg', 'png','gif'],//接收的文件后缀,
             maxFileCount: 100,
             enctype: 'multipart/form-data',
             showUpload: true, //是否显示上传按钮
             showCaption: false,//是否显示标题
             uploadAsync:false,//同步上传
             browseClass: "btn btn-primary", //按钮样式      
 	         dropZoneEnabled : false,//是否显示拖拽区域，默认不写为true，但是会占用很大区域
             previewFileIcon: "<i class='glyphicon glyphicon-king'></i>", 
             msgFilesTooMany: "选择上传的文件数量({n}) 超过允许的最大数值{m}！",
         });
		 
		 
		    //导入文件上传完成之后的事件
		    $("#photodetailcoverup").on("filebatchuploadsuccess", function (event, data, previewId, index) {
		    	console.info(data)
				$('#photodetail').val(data.response.name);
		    });
	</script>
</body>
</html>
